#pragma once
#include "DXAMLCommon.h"
#include "CParallelTimeline.h"


class VisualTransitionCompletedData;

class CStoryboard :
	public CParallelTimeline
{

private: 
	CStoryboard(CCoreServices * pCore);
	virtual ~CStoryboard();
	virtual HRESULT CopyTimelineProperties(CRenderTarget * pRenderTarget, CTimeline * pTimeline);
public: 
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual XUINT32 GetTypeIndex() const;
	virtual void SetAssociated(XINT32 fIsAssociated);
	virtual HRESULT UpdateAnimation(XFLOAT beginTime, const XFLOAT * pParentTime, XBOOL isParentInReverse, XFLOAT combinedSpeedRatio, enum DurationType durationType, XFLOAT durationValue, XBOOL isInReverse, const COptionalFloat & expirationTime, struct IFrameScheduler * pFrameScheduler, XBOOL * pIsIndependentAnimation);
	virtual HRESULT ComputeStateImpl(const XFLOAT * pParentTime, XBOOL isParentInReverse, XFLOAT combinedSpeedRatio, struct IFrameScheduler * pFrameScheduler, XBOOL * pHasNoExternalReferences, XBOOL * pHasIndependentAnimation, XBOOL * pIsInReverse);
	virtual HRESULT OnBegin();
	virtual XBOOL IsInActiveState();
	virtual XBOOL IsInStoppedState();
	virtual void EnsureIndependentStartDelta(XFLOAT independentStartDelta);
	HRESULT Pause();
	HRESULT PausePublic();
	HRESULT Resume();
	HRESULT ResumePublic();
	HRESULT Begin(XBOOL fIsTopLevel);
	HRESULT BeginPublic();
	HRESULT Stop();
	HRESULT StopPublic();
	HRESULT Seek(CTimeSpan * pSeekTime);
	HRESULT SeekPublic(XUINT32 cSeekTime, XUINT16 * pSeekTime);
	HRESULT SeekAlignedToLastTickPublic(XUINT32 cSeekTime, XUINT16 * pSeekTime);
	HRESULT SeekAlignedToLastTick(CTimeSpan * pSeekTime, XBOOL doAutoCompleteCheck);
	HRESULT SkipToFillPublic();
	HRESULT SkipToFill();
	HRESULT Complete();
	HRESULT GetDuration(enum DurationType * pDurationType, XFLOAT * prDuration);
	void SetInheritanceContextWalkForVsmProcessed(XBOOL fValue);
	XBOOL InheritanceContextWalkForVsmProcessed();
private: 
	HRESULT CompleteInternal(XBOOL stopInfiniteTimelines, XBOOL isSynchronous);
	HRESULT SeekInternal(CTimeSpan * pSeekTime, XBOOL doAutoCompleteCheck);
	XBOOL IsTopLevelStoryboard();
	XBOOL IsInPrimaryTimeManager();
public: 
	VisualTransitionCompletedData * m_pVisualTransitionCompletedData;
	struct LayoutTransitionCompletedData * m_pLayoutTransitionCompletedData;
private: 
	XBOOL m_fIsStopped:1;
	XBOOL m_fIsPaused:1;
	XBOOL m_fIsResuming:1;
	XBOOL m_fIsBeginning:1;
	XBOOL m_fIsSeeking:1;
	XBOOL m_fNeedsIndependentDeltaUpdate:1;
	XBOOL m_fInheritanceContextWalkForVsmProcessed:1;
	XFLOAT m_lastParentTime;
	XFLOAT m_rPendingSeekTime;
	XFLOAT m_rTimeDelta;
	XFLOAT m_independentTimeDelta;


};

